package com.lcu.student.mapper;

import com.lcu.student.entity.Student;
import com.lcu.student.entity.StudentGrades;
import com.lcu.student.entity.Subject;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SubjectMapper {

    /**
     * 查询所有课程，及课程编号
     * @return
     */
    @Select("select subject_name,subject_number from subject Group BY subject_number")
    public List<StudentGrades> selectSubject();


    /**
     * 带条件的分页查询
     * @param begin
     * @param size
     * @param subject
     * @return
     */
     List<Subject> selectByPage(@Param("begin") int begin, @Param("size") int size, @Param("subject") Subject subject);

    /**
     * 查询总数
     * @param subject
     * @return
     */
     int selectTotalCount(Subject subject);

    /**
     * 添加数据
     * @param subject
     */
    void addSubject(Subject subject);

    /**
     * 修改信息
     * @param subject
     */
    void updateById(Subject subject);

    /**
     * 根据id删除
     * @param id
     */
    @Delete("delete from  subject where subject_id=#{id}")
    int deleteById(String id);

    /**
     * 批量删除数据
     * @param ids
     */
    void deleteByIds(@Param("ids") List<Integer> ids);

}
